package com.yinhe.music.yhmusic.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yinhe.music.common.GlideHelper.GlideHelper;
import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.model.SongMenuList;

import java.util.List;

/**
 *
 * @author hasee
 * @date 2017/8/15
 */

public class SongMenuContentAdapter extends BaseQuickAdapter<SongMenuList, BaseViewHolder> {


    public SongMenuContentAdapter(@Nullable List<SongMenuList> data) {
        super(R.layout.recommend_menu_item, data);
    }


    public SongMenuContentAdapter() {
        super(R.layout.recommend_menu_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, SongMenuList item) {
        helper.setText(R.id.song_menu_name,item.getSongMenuName());
        helper.setText(R.id.song_menu_play_num, item.getPlay() < 10000
                ? String.valueOf(item.getPlay())
                : item.getPlay()/10000 + "万");
        helper.setGone(R.id.anchor, false);

        ImageView image = helper.getView(R.id.song_menu_img);
        GlideHelper.setImageResource(image,item.getImage(),R.drawable.default_cover);
    }
}
